package com.polymorphic.detail;

/**
 * @Author 小闽
 * @Date 2024/8/12 11:21
 * @PackageName: com.polymorphic.detail
 * @ClassName: Cat
 * @Description: 猫类
 * @Version 1.0
 */
public class Cat extends Animal {
    public  String name;
    public  int age;
    public Cat(String name, int age){
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    /**
     * 重写父类的eat()方法
     */
    public void eat(){
        System.out.println("猫吃鱼");
    }
    public void catchMouse(){
        System.out.println("猫抓老鼠");
    }
}
